/*
 * ParseTool.h
 *
 *  Created on: 2012. 10. 16.
 *      Author: dalxx
 */

#include "PLCConfig.h"

#ifndef PARSETOOL_H_
#define PARSETOOL_H_
#include <Arduino.h>

namespace PLCLib {

class ParseTool {
public:
	static unsigned long time_out;
	static const char* WhiteSpace;
	static const char* OperationDelimiter;
	static const char* EntityDelimiter;


	static int EatWhite(const char* expression, int start, int end);
	static int EatWhite(Stream* stream);
	static int EatWhiteBack(const char* expression, int start, int end);
	static int FindDelimiter(const char* expression, const char* delimiter, int start, int end);
	static bool ReadInt(int& tar, Stream* stream, char delimiter, char terminator);
	static bool ReadFloat(float& tar, Stream* stream, char delimiter, char terminator);
	static int ReadString(char* tar, const int size, Stream* stream, char delimiter, char terminator);
	//static bool FindUntil(Stream* stream, const char* delimiter, const char* terminator);
	static bool FindUntil(Stream* stream, char delimiter, char terminator);
	static int EatParenthesis(const char* expression, int start, int end);
	static int TimedRead(Stream* stream);
	static int TimedPeek(Stream* stream);

	static int Substring(char* tar, const char* src, int start, int end, int maxsize=100);





};



} /* namespace PLCLib */
#endif /* PARSETOOL_H_ */
